package com.cn.bulu.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cn.bulu.service.FactoryService;
import com.cn.bulu.utils.BuluResult;

@Controller
@RequestMapping("/factory")
public class FactoryController {
	@Resource
	private FactoryService factoryService;
	
	@RequestMapping("/login")
	@ResponseBody
	//登录
	public BuluResult login(String account,String password){
		BuluResult buluResult = factoryService.login(account,password);
		return buluResult;
	}
	//修改密码
	@RequestMapping("/updatePassword")
	@ResponseBody
	public BuluResult updatePassword(String account,String password){
		BuluResult buluResult = factoryService.updatePassword(account,password);
		return buluResult;
	}
	//首页 (新订单)
	@RequestMapping("/selectXindingdan")
	@ResponseBody
	public BuluResult selectXindingdan(Integer page){
		BuluResult buluResult = factoryService.selectXindingdan(page);
		return buluResult;
	}
	//订单详情
	@RequestMapping("/selectDxiangqing")
	@ResponseBody
	public BuluResult selectDxiangqing(Integer orderId){
		BuluResult buluResult = factoryService.selectDxiangqing(orderId);
		return buluResult;
	}
	//查询广告
	@RequestMapping("/selectGuanggao")
	@ResponseBody
	public BuluResult selectGuanggao(){
		BuluResult buluResult = factoryService.selectGuanggao();
		return buluResult;
	}
	//商品特殊有多个布尺寸或纱尺寸或帘头尺寸
	@RequestMapping("/selectGoodsDG")
	@ResponseBody
	public BuluResult selectGoodsDG(Integer goodsId){
		BuluResult buluResult = factoryService.selectGoodsDG(goodsId);
		return buluResult;
	}
	//根据商品号查询里面布的用量
	@RequestMapping("/selectGoodsYG")
	@ResponseBody
	public BuluResult selectGoodsYG(Integer goodsId){
		BuluResult buluResult = factoryService.selectGoodsYG(goodsId);
		return buluResult;
	}
	//商品特殊根据每个特殊id查询里面用量
	@RequestMapping("/selectSpecialYL")
	@ResponseBody
	public BuluResult selectSpecialYL(Integer specialId){
		BuluResult buluResult = factoryService.selectSpecialYL(specialId);
		return buluResult;
	}
	//根据前端发送的订单状态来查询订单
	@RequestMapping("/selectOrders")
	@ResponseBody
	public BuluResult selectOrders(Integer factoryStatus){
		BuluResult buluResult = factoryService.selectOrders(factoryStatus);
		return buluResult;
	}
	//根据工厂工人id和状态(可接,已接,已完成)查询数据
	@RequestMapping("/selectGOrders")
	public BuluResult selectGOrders(HttpServletRequest request,Integer type){
		BuluResult buluResult = factoryService.selectGOrders(request ,type);
		return buluResult;
	}
	//工厂工人点击我要接单
	@RequestMapping("/updateOrderType")
	@ResponseBody
	public BuluResult insertOrderType(HttpServletRequest request,Integer orderId){
		BuluResult buluResult = factoryService.insertOrderType(request,orderId);
		return buluResult;
	}
}
